Support more complex env invocations in shebang lines
authorKévin Le Gouguec <kevin.legouguec@gmail.com>
Sat, 10 Feb 2024 16:37:35 +0000 (17:37 +0100)
committerEli Zaretskii <eliz@gnu.org>
Sat, 17 Feb 2024 08:31:14 +0000 (10:31 +0200)
commitecb9641ecb5f42899042ff9c164ec7dbb8e166fe
treea07f79c3c309488ed5d7c90760759d15f6974250
parentde6f7f3c86ea0e52e8f9825585c726a7f93fa9cf
Support more complex env invocations in shebang lines

This is not an exact re-implementation of what env accepts, but
hopefully it should be "good enough".

Example of known limitation: we assume that arguments for
--long-options will be set with '=', but that is not
necessarily the case.  '--unset' (mandatory argument) can be
passed as '--unset=VAR' or '--unset VAR', but
'--default-signal' (optional argument) requires an '=' sign.

For bug#64939.

* lisp/files.el (auto-mode-interpreter-regexp): Account for
supplementary arguments passed beside -S/--split-string.
* test/lisp/files-tests.el (files-tests-auto-mode-interpreter):
Test some of these combinations.
lisp/files.el
test/lisp/files-tests.el